import React from 'react';
import { addTodo } from '../actions';

import { connect } from 'react-redux';

let AddTodoCmp = ({ dispatch }) => {
    let input;
    return (
        <div>
            <form onSubmit={e => {
                e.preventDefault();
                console.log("hello");
                dispatch(addTodo(input.value));
                input.value = '';
            }}>
                <input ref={node => { input = node }}></input>
                <button type='submit' >添加</button>
            </form>
        </div>
    )
}

let AddTodo = connect()(AddTodoCmp);
export default AddTodo;